﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 判断状态在堆栈上去留的行动
/// </summary>
[CreateAssetMenu(menuName = "MyScript/Act/ControllableAct/Chracter1Act/StayOrPopAct")]
public class StayOrPopAct : ControllableAct
{
    [SerializeField] private GameTypeDefine.BUTTON_ID[] m_button = { GameTypeDefine.BUTTON_ID.NONE };

    [SerializeField] private bool m_toChangeIsNeedToPop;

    public override ControllableObjectState Act(ButtonEventArgs args, GameObject gameObject, ControllableObjectState state)
    {
        if (state.isAtTop)
        {
            return ControllableStateMachine.remainState;
        }

        for (int i = 0, length = m_button.Length; i < length; i++)
        {
            if (args.GetButtonID() == m_button[i])
            {
                state.isNeedToPop = m_toChangeIsNeedToPop;

                return ControllableStateMachine.remainState;
            }
        }

        return base.Act(args, gameObject, state);
    }
}
